From: Keir Fraser Date: Mon, 19 Oct 2009 09:57:58 +0000 (+0100) Subject: vt-d: do not enable VT-d on acpi=off X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~13203 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/%22bookmarks://%22Dat/%22http:/www.example.com/cgi/%22https:/%22bookmarks:/%22Dat?a=commitdiff_plain;h=980aa0a42fe6581c47b4efbacfad7966de5098f7;p=xen.git vt-d: do not enable VT-d on acpi=off This reverts changeset 20323: 2370e16ab6d3 and adds a small check to iommu_setup() which should more correctly cover all cases. Signed-off-by: Dexuan Cui --- diff --git a/xen/drivers/passthrough/iommu.c b/xen/drivers/passthrough/iommu.c index b1ce67f741..9f5c40f5e0 100644 --- a/xen/drivers/passthrough/iommu.c +++ b/xen/drivers/passthrough/iommu.c @@ -266,9 +266,13 @@ int iommu_setup(void) { int rc = -ENODEV; - rc = iommu_hardware_setup(); - - iommu_enabled = (rc == 0); + if ( acpi_disabled ) + iommu_enabled = 0; + else + { + rc = iommu_hardware_setup(); + iommu_enabled = (rc == 0); + } if ( force_iommu && !iommu_enabled ) panic("IOMMU setup failed, crash Xen for security purpose!\n"); diff --git a/xen/drivers/passthrough/vtd/intremap.c b/xen/drivers/passthrough/vtd/intremap.c index 595afbaa1e..bad38ff7d3 100644 --- a/xen/drivers/passthrough/vtd/intremap.c +++ b/xen/drivers/passthrough/vtd/intremap.c @@ -575,8 +575,7 @@ void msi_msg_read_remap_rte( struct iommu *iommu = NULL; struct ir_ctrl *ir_ctrl; - if ( (drhd = acpi_find_matched_drhd_unit(pdev)) == NULL ) - return; + drhd = acpi_find_matched_drhd_unit(pdev); iommu = drhd->iommu; ir_ctrl = iommu_ir_ctrl(iommu); @@ -594,8 +593,7 @@ void msi_msg_write_remap_rte( struct iommu *iommu = NULL; struct ir_ctrl *ir_ctrl; - if ( (drhd = acpi_find_matched_drhd_unit(pdev)) == NULL ) - return; + drhd = acpi_find_matched_drhd_unit(pdev); iommu = drhd->iommu; ir_ctrl = iommu_ir_ctrl(iommu); diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c index af611a9d40..5cc69e98c7 100644 --- a/xen/drivers/passthrough/vtd/iommu.c +++ b/xen/drivers/passthrough/vtd/iommu.c @@ -1349,8 +1349,7 @@ static int reassign_device_ownership( if (!pdev) return -ENODEV; - if ( (drhd = acpi_find_matched_drhd_unit(pdev)) == NULL ) - return -ENODEV; + drhd = acpi_find_matched_drhd_unit(pdev); pdev_iommu = drhd->iommu; domain_context_unmap(source, bus, devfn); @@ -1364,7 +1363,7 @@ static int reassign_device_ownership( for_each_pdev ( source, pdev ) { drhd = acpi_find_matched_drhd_unit(pdev); - if ( drhd && drhd->iommu == pdev_iommu ) + if ( drhd->iommu == pdev_iommu ) { found = 1; break;